package com.xbongbong.saas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

/**
 * 采购退货状态
 * @author 吴峰
 * @version v1.0
 * @date 2019/4/12 14:09
 * @since v1.0
 */
@Getter
public enum ReturnedPurchaseStatusEnum {

    /**
     * 采购退货状态
     */
    WAIT_OUTSTOCK(1, InOutStockStatusEnum.WAIT_OUTSTOCK.getI18nName()),

    OUTSTOCK(2, InOutStockStatusEnum.OUTSTOCK.getI18nName()),

    NONE(404, "enum.returnedPurchaseStatus.memo.none");

    private Integer status;

    private String memo;

    ReturnedPurchaseStatusEnum(Integer status, String memo) {
        this.status = status;
        this.memo = memo;
    }

    public ReturnedPurchaseStatusEnum getByCode(Integer code) {
        for (ReturnedPurchaseStatusEnum redundantTemplateTypeEnum: values()) {
            if (redundantTemplateTypeEnum.getStatus().equals(code)) {
                return redundantTemplateTypeEnum;
            }
        }
        return NONE;
    }

    public String getMemo() {
        return I18nMessageUtil.getMessage(memo);
    }
}
